package com.ink;

import com.printer.Ink;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.awt.*;

@Component("greyInk")
public class GreyInk implements Ink {
    /**
     * 打印采灰色文字
     */
    public String getColor(int red, int green, int blue) {
        int c = (red + green + blue) / 3;
        Color color = new Color(c, c, c);
        return "#" + Integer.toHexString(color.getRGB()).substring(2);
    }

}
